#include <bits/stdc++.h>
using namespace std;
int m, k;

int main() {
    cin >> m >> k;

    if (m % 19 != 0) {
        cout << "NO"; 
        return 0;
    }

    int m1 = m;
    while (m1 > 0) {
        if (m1 % 10 == 3)
            k--;
        m1 = m1 / 10;
    }

    if (k == 0)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}